package com.example.springtest.service.impl;

import com.example.springtest.entity.ResEntity;
import com.example.springtest.service.TypeService;
import org.springframework.stereotype.Service;

@Service("TypeService")
public class TypeServiceImpl implements TypeService {

    public ResEntity typeJudge(Object obj) {
        ResEntity resEntity = new ResEntity();
        String result = null;
        if (null == obj || "".equals(obj)) {
            result = "null";
        } else if (obj instanceof Integer) {
            result = "Integer";
        } else if (obj instanceof String) {
            result = "String";
        } else if (obj instanceof Double) {
            result = "Double";
        } else if (obj instanceof Long) {
            result = "Long";
        } else if (obj instanceof Boolean) {
            result = "Boolean";
        } else {
            result = "unable to judge type";
        }
        resEntity.setResult(result);
        return resEntity;
    }
}
